package com.cyan.app.workflow.bean;

import android.content.Context;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;

/**
 * Created by DXW on 2016/2/22.
 * 工单流转类
 */
public class GdlkBean {
        private static final String TAG = "GdlkMannoLab";
        private static final String FILENAME = "gdlk.json";
        private static GdlkBean sGdlkMannoLab;
        private ArrayList<GdlkMannoBean> mMannos;
        private Context mAppContext;

        public GdlkBean(Context appContext) {
            mAppContext = appContext;
            mMannos = new ArrayList<GdlkMannoBean>();
        }
        public void addManno(GdlkMannoBean mannoBean) {
            mMannos.add(mannoBean);
        }

        public GdlkMannoBean getManno(String manno) {
            for (GdlkMannoBean c : mMannos) {
                if (c.getManno().equals(manno))
                    return c;
            }
            return null;
        }

        public void deleteCrime(GdlkMannoBean mannoBean) {
            mMannos.remove(mannoBean);
        }

        public ArrayList<GdlkMannoBean> getMannos() {
            return mMannos;
        }

        public static GdlkBean get(Context c) {
            if (sGdlkMannoLab == null) {
                sGdlkMannoLab = new GdlkBean(c.getApplicationContext());
            }
            return sGdlkMannoLab;
        }

    public class GdlkMannoBean{
        private String Manno;
        private int Manqty;
        private String Itnbr;
        private boolean IsSelected;

        public boolean isSelected() {
            return IsSelected;
        }

        public void setIsSelected(boolean isSelected) {
            IsSelected = isSelected;
        }
        public String getItnbr() {
            return Itnbr;
        }

        public void setItnbr(String itnbr) {
            Itnbr = itnbr;
        }

        public int getManqty() {
            return Manqty;
        }

        public void setManqty(int manqty) {
            Manqty = manqty;
        }

        public String getManno() {
            return Manno;
        }

        public void setManno(String manno) {
            Manno = manno;
        }

        public JSONObject toJSON() throws JSONException {
            JSONObject json = new JSONObject();
            json.put("Manno", Manno);
            json.put("Manqty", Manqty);
            json.put("Itnbr", Itnbr);
            return json;
        }
    }


}

